﻿using System.Globalization;

namespace monitor_2_DBwork
{
    //[Class(Table = "Users", Name = "monitor_2_DBwork.Users")]
    class Users : IRepositoryName
    {
        //int _id;
        //string _login;
        //int _passhash;
        //int _access;
        //string _info;
        //Access _accessInfo;

        #region attributes

        public virtual int Id
        {
            get; protected set; }

        public virtual string Name
        {
            get; set; }

        public virtual int PasswordHashCode
        {
            get; set; }

        public virtual int Access
        {
            get; set; }

        public virtual string Information
        {
            get; set; }

        public virtual Access AccessInfo
        {
            get;
            set;
        }

        #endregion

        public Users() { }

        public Users(string a, string b, int c, string d)
        {
            Name = a;
            PasswordHashCode = b.GetHashCode();
            Access = c;
            Information = d;
        }

        protected internal virtual new string ToString()
        {
            //string access = (CultureInfo.CurrentCulture.Name == "ru-RU") ? AccessInfo.Name : AccessInfo.enUS;
            string access = "";
            switch (Access)
            {
                case 1:
                    access = DBwork.ResourceManager.GetString("Admin");
                    break;
                case 2:
                    access = DBwork.ResourceManager.GetString("User");
                    break;
            }
            return Name + ":" + access + ":" + Information + ";";
        }
        
    }
}
